package com.github.caijh.mall.common.validator;

import javax.inject.Inject;

import com.github.caijh.framework.data.redis.Redis;
import com.github.caijh.mall.constants.Constants;
import org.springframework.stereotype.Component;

@Component
public class AdminTokenValidator implements TokenRedisValidator {

    public static String st = "ags0o175LNCnToaXF9EaLdQ";
    public static String sk = "p&va7ylslUKwgx1vm8）L";
    @Inject
    private Redis redis;

    @Override
    public String getKey(String token) {
        return Constants.ADMIN_USER_TOKEN_REDIS_KEY_PREFIX + token;
    }

    @Override
    public String getValue(String key) {
        return redis.get(key);
    }

    @Override
    public void setValue(String key, String value) {
        redis.set(key, value, Constants.TOKEN_EXPIRE_SECONDS);
    }

}
